<?php
define("USER_ID_KEY", "2813F923-E883-48C8-8DD8-66116A28CF7B");

// Eglės
$RootDirectoryUri = "http://".$_SERVER["HTTP_HOST"].'/egle/SQLPamokos';

/*
// Gedimino
$RootDirectoryUri = "http://".$_SERVER["HTTP_HOST"].'/sql-pamokos';
*/

class CurrentClient
{
	public $id = '';
	public $email = '';
	public $name = '';
	public $link = '';
	public $picture = '';
	public $locale = '';
    public $isActive = false;
    public $isAdministrator = false;
    public $allRoles = '';
}

function isActive()
{
	if(!$this->isActive) 
		return FALSE;
	else {
		return $this->isAdmin || strlen($this->allRoles) > 0;	
	}
}

function isInRole($roleName)
{
	if(!$this->isActive || strlen($this->allRoles) < 2) 
		return FALSE;
	elseif ($this->isAdmin) {
		return TRUE;
	}
	else {
		$roleArray = explode($this->allRoles);
		return in_array($roleName, $roleArray);	
	}
}
?>
